package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyRecRecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class RecRecordAdapter extends StkProviderMultiAdapter<MyRecRecordBean> {

    public RecRecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new RecRecordProvider());
    }

    private class RecRecordProvider extends BaseItemProvider<MyRecRecordBean> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_rec_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyRecRecordBean bean) {
            Glide.with(getContext()).load(bean.getImgPath())
                    .into((ImageView) baseViewHolder.getView(R.id.ivRecRecordItemImg));
            baseViewHolder.setText(R.id.tvRecRecordItemName, bean.getName());
            baseViewHolder.setText(R.id.tvRecRecordItemTime, bean.getTime());
            baseViewHolder.setText(R.id.tvRecRecordItemDesc, bean.getDesc());
        }

    }

}
